import { measurementHttp } from '/@/utils/http/axios';
import { appItem, SdrDetailItem, SdrDetailParam, SdrParams, SrdRecordResultModel, tenantItem } from './model/sdrModel';

enum Api {
  GET_TENANT_LIST = '/v1/measurement/basic/tenantList',
  GET_APP_LIST = '/v1/measurement/basic/bizAppList',
  GET_SDR_LIST = '/v1/measurement/sdr/tenantAppList',
  GET_SDR_DETAIL = '/v1/measurement/sdr/tenantAppDetail',
}

export const getTenantList = () => {
  // 获取租户列表
  return measurementHttp.get<tenantItem[]>({ url: Api.GET_TENANT_LIST });
};

export const getAppList = () => {
  // 获取企业应用列表
  return measurementHttp.get<appItem[]>({ url: Api.GET_APP_LIST });
};

export const getSdrList = (params: SdrParams) => {
  // 获取话单列表
  return measurementHttp.get<SrdRecordResultModel>({ url: Api.GET_SDR_LIST, params });
};

export const getSdrDetail = (params: SdrDetailParam) => {
  // 获取话单详情
  return measurementHttp.get<SdrDetailItem>({
    url: Api.GET_SDR_DETAIL,
    params,
  });
};
